Type.registerNamespace("Telerik.Web.UI.Scheduler.Rendering");
(function(){var a=Telerik.Web.UI.Scheduler.Rendering;
a.BlockCollection=function(){this._blocks=new Array();
};
a.BlockCollection.prototype={add:function(d){var c;
if(this._blocks.length==0){c=this._createBlock();
}else{var b=new Array();
for(var e=0;
e<this._blocks.length;
e++){if(this._blocks[e].overlapsWith(d)){Array.add(b,this._blocks[e]);
}}if(b.length==0){c=this._createBlock();
}else{if(b.length==1){c=b[0];
}else{c=this._mergeBlocks(b);
}}}c.add(d);
},remove:function(d){var b=[];
var c,e;
for(c=0,e=this._blocks.length;
c<e;
c++){this._blocks[c].remove(d);
if(this._blocks[c]._parts.length==0){Array.add(b,this._blocks[c]);
}}for(c=0,e=b.length;
c<e;
c++){Array.remove(this._blocks,b[c]);
}},forEach:function(c){for(var d=0,b=this._blocks.length;
d<b;
d++){this._blocks[d].forEach(c);
}},_createBlock:function(){var b=new a.Block();
var c=this._blocks.length;
Array.insert(this._blocks,c,b);
return b;
},_mergeBlocks:function(c){var f=c[0];
for(var b=0;
b<c.length;
b++){var d=c[b];
if(d==f){continue;
}for(var e=0;
e<d._parts.length;
e++){f.add(d._parts[e]);
}Array.remove(this._blocks,d);
}return f;
}};
a.BlockCollection.registerClass("Telerik.Web.UI.Scheduler.Rendering.BlockCollection");
})();
